package 剑指offer;

import common.ListNode;

/**
 * @author zhangjunfei
 * @date 2023/7/20 16:24
 */
public class O_52 {
    ListNode getIntersectionNode(ListNode headA, ListNode headB) {
        ListNode temp1 = headA;
        ListNode temp2 ;
        while (temp1 != null) {
            temp2 = headB;
            while (temp2 != null) {
                if (temp2 == temp1) {
                    return temp1;
                }
                temp2 = temp2.next;
            }
            temp1 = temp1.next;
        }
        return null;
    }
}
